package cn.itcast.service.system.impl;


import cn.itcast.dao.system.SysLogDao;

import cn.itcast.domain.system.SysLog;
import cn.itcast.service.system.LogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;


//日志
@Service
public class LogServiceImpl implements LogService {
  @Autowired
  private SysLogDao sysLogDao;
//查所有
    @Override
    public PageInfo findByCompanyId(int pageNum, int pageSize, String companyId) {
        //1.设置分页参数
        PageHelper.startPage(pageNum,pageSize);
        //2.查询所有数据
        List<SysLog> list =sysLogDao.findByCompanyId(companyId);
        //3.封装PageInfo
        return  new PageInfo<>(list);

    }

    @Override
    public void save(SysLog sysLog) {
        sysLog.setId(UUID.randomUUID().toString());
        sysLogDao.save(sysLog);
    }
}
